<?php
	session_start();
	if ($_POST) {
		header("Location: " . $_POST['pageBack']);
		$_SESSION["keyValue"] = $_POST["keyValue"];
		include("config/login-defs.php");
		$formAction = $_POST["formFuncAction"];
		if ($formAction == "excluir") {
			$query = "delete from funcao where id_funcionario = " . $_POST["idFunc"] . " and id_depto = " . $_POST["idDepto"] ;
			$data = mysql_query($query) or print(mysql_error());
		} else if ($formAction == "associar") {
			$query = "insert into funcao (id_funcionario, id_depto, funcoes) values 
					  (" . $_POST["idFunc"] . ", " . $_POST["idDeptoAssociar"] . ",'" . $_POST["fldFuncao"] ."')" ;
			$data = mysql_query($query) or print(mysql_error());
		}
		
	}
?>